const serviceDiscovery = require('./ptServiceDiscovery');

let serviceDiscoveryPolling = {Services:{}};

serviceDiscoveryPolling.polling = async () => {
  const d1 = await serviceDiscovery.refresh("src-pt-core-feeds");
  const d2 = await serviceDiscovery.refresh("src-pt-core-market");
  const d3 = await serviceDiscovery.refresh("src-pt-core-operation");
  const d4 = await serviceDiscovery.refresh("src-pt-core-reports");
  const d5 = await serviceDiscovery.refresh("src-pt-core-admin");

  serviceDiscoveryPolling.Services["src-pt-core-feeds"] = d1;
  serviceDiscoveryPolling.Services["src-pt-core-market"] = d2;
  serviceDiscoveryPolling.Services["src-pt-core-operation"] = d3;
  serviceDiscoveryPolling.Services["src-pt-core-reports"] = d4;
  serviceDiscoveryPolling.Services["src-pt-core-admin"] = d5;

  setTimeout(serviceDiscoveryPolling.polling, 1000 * 60 * 30); // 30 mins
};

module.exports = serviceDiscoveryPolling;

